#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include <string.h>

bool status;

typedef struct Project
{
    long projectId;
    char projectName[999];
    short projectStatus; //0为未开始，1为进行中，2为已完成
    short projectAwards; //0为未获奖，1为1等奖(500)，2为2等奖(300)，3为三等奖(100)
    struct Project *nextProject;
} Project, *ProjectList;

typedef struct Thesis
{
    long thesisId;
    char thesisName[999];
    short thesisStatus; //0为未开始，1为进行中，2为已完成
    short thesisAwards; //0为未获奖，1国家级，2为省部级，3为市厅级,4为校级
    short thesisType;   //0为无，1为SCI(500)，2为EI(300)，3为核心(100)，4为一般(50)
    struct Thesis *nextThesis;
} Thesis, *ThesisList;
typedef struct Essay
{
    long essayId;
    char essayName[999];
    short essayType; //0为无，1为国家标准(500)，2为行业标准(300)，3为专辑(200)，4为学术专著(100)，5为其他（含译著）(50)
    struct Essay *nextEssay;
} Essay, *EssayList;

typedef struct User
{
    long id;
    char name[10]; //姓名
    User *nextUser;
    Project *nextProject;
    Thesis *nextThesis;
    Essay *nextEssay;
} User, *UserList;

typedef struct Rank
{
    int score;
    char name[10];
    Rank *nextRank;
    Rank *lastRank;
} Rank, *RankList;

UserList InitUser();                                 //此函数用于初始化头指针
bool AddUser(UserList head, long id, char name[10]); //此函数是添加用户核心函数
UserList SearchUser(UserList head, long id);         //此函数是用户查询核心函数
bool DeleteUser(UserList head, long id);             //此函数是核心删除函数
bool ShowAllUser(UserList head);                     //此函数返回所有用户的所有数据
bool ShowUserAll(UserList user);                     //此函数返回传入用户的所有数据
void AddUserApp(UserList head);                      //此函数通过调用核心添加函数实现用户数据的输入
bool AddProject(UserList user,
                long projectId,
                char projectName[999],
                short projectStatus,
                short projectAwards);                     //此函数是项目输入核心函数
ProjectList SearchProject(UserList user, long projectId); //此函数是项目查询核心函数
bool ShowAllProject(UserList user);                       //此函数用于显示所有项目
bool DeleteProject(UserList user, long projectId);        //此函数是项目删除核心函数
void AddProjectApp(UserList head, long userId);           //此项目通过调用核心函数实现项目的输入
bool AddThesis(
    UserList user,
    long thesisId,
    char thesisName[999],
    short thesisStatus,
    short thesisAwards,
    short thesisType);                                 //此函数是论文添加核心函数
ThesisList SearchThesis(UserList user, long thesisId); //此函数是论文查找核心函数
bool ShowAllThesis(UserList user);                     //此函数用于显示所有论文
bool DeleteThesis(UserList user, long thesisId);       //此函数是论文删除核心函数
void AddThesisApp(UserList head, long userId);         //此函数通过调用核心函数实现论文添加
bool AddEssay(UserList user,
              long essayId,
              char essayName[999],
              short essayType);                           //此函数是著作添加核心函数
EssayList SearchEssay(UserList user, long essayId); //此函数是著作查询核心函数
bool ShowAllEssay(UserList user);                   //此函数用于显示所有著作
bool DeleteEssay(UserList user, long essayId);      //此函数是著作删除核心函数
void AddEssayApp(UserList head, long userId);       //此函数通过调用核心函数实现著作输入
RankList InitRank();                                //此函数生成排名的头节点
bool AddRank(RankList rankHead, Rank rank0);        //此函数接收积分信息并排序添加到排名表中
void ShowRank(UserList head, RankList rankHead);    //此函数用于统计积分信息并输出
void Menu(UserList head);                           //生成主界面的函数
void Set(UserList head);                            //功能选择函数
void InformationPanel(UserList head) ;
void SetInformation(UserList head) ;
void UserPanel(UserList head) ;
void SetUser(UserList head) ;
void ProjectPanel(UserList head) ;
void SetProjuct(UserList head) ;
void ThesisPanel(UserList head) ;
void SetThesis(UserList head) ;
void BackMenu(UserList head);
void ModifyThesisApp(UserList head, long userId);
void Login(UserList head)
{
    char name[] = "00000", pwd[] = "admin"; //正确的用户名和密码
    char username[10], userpwd[100];        //用户输入的用户名和密码
    {
        system("color F1");
        printf("\n\n\n\n\n\n\n\n\n");
        printf("                                             University scientific research management system\n\n");
        printf("                                             欢迎使用高校科研管理系统!\n\n");

    re:
        printf("                                             请输入管理员账号:");
        gets(username);
        printf("\n");
        printf("                                             请输入密码:");
        fflush(stdin); //清理缓存区
        int m;
        for (m = 0; m < 100; m++) //隐藏密码功能
        {
            userpwd[m] = getch(); //读入用户名
            if (userpwd[m] == '\r')
                break;
            if (userpwd[m] == 8 && m > 0) //如果用户按退格键
            {
                printf("\b \b"); //显示退一格
                m = m - 2;       //输入数据退1
                continue;
            }
            if (userpwd[m] == 8 && m == 0) //无格可退时按退格键
            {
                m = m - 1; //输入数据退1
                continue;
            }
            printf("*");
        }
        userpwd[m] = '\0';
        //如果用户名和密码正确,则登录成功,返回1
        printf("\n\n");
        if (strcmp(name, username) == 0 && strcmp(pwd, userpwd) == 0)
        {
            // LoadFromFile(); //读取数据
            system("cls"); //清空屏幕
            Menu(head);    //进入主页面
        }
        else
        {
            printf("                                             账号或密码错误,请重新输入!\n\n");
            goto re; //重新输入账号密码
        }
    }
}

UserList InitUser()
{
    UserList head = (UserList)malloc(sizeof(User));

    //记录长度
    head->nextUser = NULL;
    head->nextProject = NULL;
    head->nextThesis = NULL;
    head->nextEssay = NULL;
    head->id = 0;
    if (NULL == head)
    {
        printf("链表动态分配失败！程序终止！\n");
        exit(-1);
    }
    return head;
}

RankList InitRank()
{
    RankList rankHead = (RankList)malloc(sizeof(Rank));
    rankHead->nextRank = NULL;
    rankHead->lastRank = NULL;
    rankHead->score = 0;
    if (NULL == rankHead)
    {
        printf("链表动态分配失败！程序终止！\n");
        exit(-1);
    }
    return rankHead;
}

bool AddUser(UserList head, long id, char name[10])
{
    if (head == NULL)
    {
        return false;
    }
    UserList user = (UserList)malloc(sizeof(User));
    UserList temp = (UserList)malloc(sizeof(User));
    user->id = id;
    strcpy(user->name, name);
    // essay->essayName[999] = essayName;
    if (head->nextUser == NULL)
    {

        head->nextUser = user;
        user->nextUser = NULL;
        //新加上
        user->nextProject = NULL;
        user->nextEssay = NULL;
        user->nextThesis = NULL;
    }
    else
    {
        temp = head->nextUser;
        while (temp->nextUser != NULL)
        {
            temp = temp->nextUser;
        }
        temp->nextUser = user;
        user->nextUser = NULL;

        //新加上
        user->nextProject = NULL;
        user->nextEssay = NULL;
        user->nextThesis = NULL;
    }
    return true;
}
bool AddProject(UserList user,
                long projectId,
                char projectName[999],
                short projectStatus,
                short projectAwards)
{
    if (user == NULL)
    {
        return false;
    }
    ProjectList project = (ProjectList)malloc(sizeof(Project));
    ProjectList temp = (ProjectList)malloc(sizeof(Project));
    project->projectId = projectId;
    strcpy(project->projectName, projectName);

    project->projectStatus = projectStatus;
    project->projectAwards = projectAwards;
    if (user->nextProject == NULL)
    {
        user->nextProject = project;
        project->nextProject = NULL;
    }
    else
    {
        temp = user->nextProject;
        while (temp->nextProject != NULL)
        {
            temp = temp->nextProject;
        }
        temp->nextProject = project;
        project->nextProject = NULL;
    }
    return true;
}
bool AddThesis(
    UserList user,
    long thesisId,
    char thesisName[999],
    short thesisStatus,
    short thesisAwards,
    short thesisType)
{
    if (user == NULL)
    {
        return false;
    }
    ThesisList thesis = (ThesisList)malloc(sizeof(Thesis));
    ThesisList temp = (ThesisList)malloc(sizeof(Thesis));
    thesis->thesisId = thesisId;
    // thesis->thesisName[999] = thesisName[999];
    // thesis->thesisUserName[432] = thesisUserName[432];
    strcpy(thesis->thesisName, thesisName);
    thesis->thesisStatus = thesisStatus;
    thesis->thesisAwards = thesisAwards;
    thesis->thesisType = thesisType;
    if (user->nextThesis == NULL)
    {
        user->nextThesis = thesis;
        thesis->nextThesis = NULL;
    }
    else
    {
        temp = user->nextThesis;
        while (temp->nextThesis != NULL)
        {
            temp = temp->nextThesis;
        }
        temp->nextThesis = thesis;
        thesis->nextThesis = NULL;
    }
    return true;
}
bool AddEssay(UserList user, long essayId, char essayName[999], short essayType)
{
    if (user == NULL)
    {
        return false;
    }
    EssayList essay = (EssayList)malloc(sizeof(Essay));
    EssayList temp = (EssayList)malloc(sizeof(Essay));
    essay->essayId = essayId;
    strcpy(essay->essayName, essayName);
    essay->essayType = essayType;
    if (user->nextEssay == NULL)
    {
        user->nextEssay = essay;
        essay->nextEssay = NULL;
    }
    else
    {
        temp = user->nextEssay;
        while (temp->nextEssay != NULL)
        {
            temp = temp->nextEssay;
        }
        temp->nextEssay = essay;
        essay->nextEssay = NULL;
    }
    return true;
}
bool AddRank(RankList rankHead, Rank rank0)
{
    int debug = 0;
    if (rankHead == NULL)
    {
        return false;
    }
    RankList lastTemp = (RankList)malloc(sizeof(Rank));
    RankList temp = (RankList)malloc(sizeof(Rank));
    RankList rank = (RankList)malloc(sizeof(Rank));
    strcpy(rank->name, rank0.name);
    rank->score = rank0.score;
    if (rankHead->nextRank == NULL)
    {
        rankHead->nextRank = rank;
        rank->nextRank = NULL;
    }
    else
    {

        lastTemp = rankHead;
        temp = rankHead->nextRank;
        while (temp != NULL)
        {
            debug++;

            if (temp->score < rank->score)
            {
                lastTemp->nextRank = rank;
                rank->nextRank = temp;
                return true;
            }
            lastTemp = lastTemp->nextRank;
            temp = temp->nextRank;
        }
        temp->nextRank = rank;
        rank->nextRank = NULL;
    }

    return true;
}

UserList SearchUser(UserList head, long id)
{
    UserList temp = (UserList)malloc(sizeof(User));
    if (head->nextUser == NULL || head == NULL)
    {
        status = 0;
        return NULL;
    }
    else
    {
        temp = head->nextUser;
        if (temp->id == id)
        {
            status = 1;
            return temp;
        }
        while (temp->nextUser != NULL)
        {
            temp = temp->nextUser;
            if (temp->id == id)
            {
                status = 1;
                return temp;
            }
        }
    }
    status = 0;
    return NULL;
}

ProjectList SearchProject(UserList user, long projectId)
{
    ProjectList temp = (ProjectList)malloc(sizeof(Project));
    if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        return NULL;
    }
    else
    {
        temp = user->nextProject;
        if (temp->projectId == projectId)
        {
            status = 1;
            return temp;
        }
        while (temp->nextProject != NULL)
        {
            temp = temp->nextProject;
            if (temp->projectId == projectId)
            {
                status = 1;
                return temp;
            }
        }
    }
    status = 0;
    return NULL;
}

ThesisList SearchThesis(UserList user, long thesisId)
{
    ThesisList temp = (ThesisList)malloc(sizeof(Thesis));
    if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        return NULL;
    }
    else
    {
        temp = user->nextThesis;
        if (temp->thesisId == thesisId)
        {
            status = 1;
            return temp;
        }
        while (temp->nextThesis != NULL)
        {
            temp = temp->nextThesis;
            if (temp->thesisId == thesisId)
            {
                status = 1;
                return temp;
            }
        }
    }
    status = 0;
    return NULL;
}

EssayList SearchEssay(UserList user, long essayId)
{
    EssayList temp = (EssayList)malloc(sizeof(Essay));
    if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        return NULL;
    }
    else
    {
        temp = user->nextEssay;
        if (temp->essayId == essayId)
        {
            status = 1;
            return temp;
        }
        while (temp->nextEssay != NULL)
        {
            temp = temp->nextEssay;
            if (temp->essayId == essayId)
            {
                status = 1;
                return temp;
            }
        }
    }
    status = 0;
    return NULL;
}

void ModifyUser(UserList user, char name[10])
{
    strcpy(user->name, name);
}
void ModifyProject(
    ProjectList project,
    long projectId,
    char projectName[999],
    short projectStatus,
    short projectAwards)
{
    if (projectName != NULL)
        strcpy(project->projectName, projectName);
    if (projectStatus != NULL)
        project->projectStatus = projectStatus;
    if (projectAwards != NULL)
        project->projectAwards = projectAwards;
}
void ModifyThesis(ThesisList thesis, long thesisId, char thesisName[999], short thesisStatus, short thesisAwards, short thesisType)
{
    if (thesisName != NULL)
        strcpy(thesis->thesisName, thesisName);
    if (thesisStatus != NULL)
        thesis->thesisStatus = thesisStatus;
    if (thesisAwards != NULL)
        thesis->thesisAwards = thesisAwards;
    if (thesisType != NULL)
        thesis->thesisType = thesisType;
}
void ModifyEssay(EssayList essay, long essayId, char essayName[999], short essayType)
{
    if (essayName != NULL)
        strcpy(essay->essayName, essayName);
    if (essayName != NULL)
        essay->essayType = essayType;
}

void ModifyUserApp(UserList head)
{
    long userId;
    char userName[256];
    printf("请输入你要修改的用户Id:");
    while (!scanf("%ld", &userId))
    {
        printf("请输入正确的数据类型\n");
        fflush(stdin);
    }
    if (SearchUser(head, userId) == NULL)
    {
        printf("未找到此用户!\n");
        return;
    }

    printf("请输入要修改的用户名:");
    fflush(stdin);
    scanf("%s", userName);
    ModifyUser(SearchUser(head, userId), userName);
    printf("是否要修改用户的项目信息\ny 是 其他按键 否\n");
    fflush(stdin);
    char c = _getch();
    if (c == 'y')
    {
        ModifyProjectApp(head, userId);
    }
    printf("是否要修改用户的论文信息\ny 是 其他按键 否\n");
    fflush(stdin);
    c = _getch();
    if (c == 'y')
    {
        ModifyThesisApp(head, userId);
    }
}

void ModifyProjectApp(UserList head, long userId)
{
    long projectId;
    char projectName[256];
    short projectStatus;
    short projectAwards;
    if (userId == 0)
    {
        printf("请输入你要修改的用户Id:");
        while (!scanf("%ld", &userId))
        {
            printf("请输入正确的数据类型\n");
            fflush(stdin);
        }
        if (SearchUser(head, userId) == NULL)
        {
            printf("未找到此用户!\n");
            return;
        }
    }
    printf("请输入要修改的项目id:");
    while (!scanf("%ld", &projectId))
    {
        printf("请输入正确的数据类型\n");
        fflush(stdin);
    }
    if (SearchProject(SearchUser(head, userId), projectId) == NULL)
    {
        printf("未找到此项目\n");
        return;
    }
    printf("请输入要修改的新名称:");
    scanf("%s", projectName);

    printf("请输入要修改的项目状态（不修改请填非法数据\n0为未开始，1为进行中，2为已完成\n");
    fflush(stdin);

    if (scanf("%hd", &projectStatus))
    {
        if (projectStatus <= 2 && projectStatus >= 0)
        {
            printf("修改成功 \n");
        }
        else
        {
            printf("未修改\n");
            projectStatus == NULL;
        }
    }
    else
    {
        printf("未修改\n");
        projectStatus == NULL;
    }

    printf("请输入要修改的项目获奖情况(不修改请输入非法字符)\n0为未获奖，1国家级，2为省部级，3为市厅级,4为校级\n");
    if (scanf("%hd", &projectAwards))
    {
        if (projectAwards <= 4 && projectAwards >= 0)
        {
            printf("修改成功 \n");
        }
        else
        {
            printf("没有修改\n");
            projectAwards == NULL;
        }
    }
    else
    {
        printf("没有修改\n");
        projectAwards == NULL;
    }

    ModifyProject(SearchProject(SearchUser(head, userId), projectId), projectId, projectName, projectStatus, projectAwards);
}

void ModifyThesisApp(UserList head, long userId)
{
    long thesisId;
    char thesisName[256];
    short thesisStatus;
    short thesisAwards;
    short thesisType;

    if (userId == 0)
    {
        printf("请输入你要修改的用户Id:");
        while (!scanf("%ld", &userId))
        {
            printf("请输入正确的数据类型\n");
            fflush(stdin);
        }
        if (SearchUser(head, userId) == NULL)
        {
            printf("未找到此用户!\n");
            return;
        }
    }

    printf("请输入要修改的论文id:");
    while (!scanf("%ld", &thesisId))
    {
        printf("请输入正确的数据类型\n");
        fflush(stdin);
    }
    if (SearchThesis(SearchUser(head, userId), thesisId) == NULL)
    {
        printf("未找到此论文\n");
        return;
    }
    printf("请输入要修改的新名称:");
    scanf("%s", thesisName);

    printf("请输入要修改的论文状态（不修改请填非法数据\n0为未开始，1为进行中，2为已完成\n");
    fflush(stdin);

    if (scanf("%hd", &thesisStatus))
    {
        if (thesisStatus <= 2 && thesisStatus >= 0)
        {
            printf("修改成功 \n");
        }
        else
        {
            printf("未修改\n");
            thesisStatus == NULL;
        }
    }
    else
    {
        printf("未修改\n");
        thesisStatus == NULL;
    }

    printf("请输入要修改的论文获奖情况(不修改请输入非法字符)\n0为未获奖，1国家级，2为省部级，3为市厅级,4为校级\n");
    if (scanf("%hd", &thesisAwards))
    {
        if (thesisAwards <= 4 && thesisAwards >= 0)
        {
            printf("修改成功 \n");
        }
        else
        {
            printf("没有修改\n");
            thesisAwards == NULL;
        }
    }
    else
    {
        printf("没有修改\n");
        thesisAwards == NULL;
    }

    printf("请输入要修改的论文类型(不修改请输入非法字符)\n0为无，1为SCI(500)，2为EI(300)，3为核心(100)，4为一般(50)\n");
    if (scanf("%hd", &thesisType))
    {
        if (thesisType <= 5 && thesisType >= 0)
        {
            printf("修改成功 \n");
        }
        else
        {
            printf("没有修改\n");
            thesisType == NULL;
        }
    }
    else
    {
        printf("没有修改\n");
        thesisType == NULL;
    }

    ModifyThesis(SearchThesis(SearchUser(head, userId), thesisId), thesisId, thesisName, thesisStatus, thesisAwards, thesisType);
}

bool ShowAllUser(UserList head)
{
    UserList temp = (UserList)malloc(sizeof(User));
    temp = head;
    if (head->nextUser == NULL)
    {
        printf("表不存在，查询失败\n");

        return false;
    }
    else
    {
        while (temp->nextUser != NULL)
        {
            temp = temp->nextUser;

            printf("\nID:%ld 名字:%s \n", temp->id, temp->name);

            if (!ShowAllProject(temp))
                printf("该人员没有所属项目\n");
            if (!ShowAllThesis(temp))
                printf("该人员没有论文\n");
            ShowAllEssay(temp);
        }

        return true;
    }
}

bool ShowAllProject(UserList user)
{
    ProjectList temp = (ProjectList)malloc(sizeof(ProjectList));
    temp = user->nextProject;
    if (user->nextProject == NULL)
    {
        //printf("该人员没有所属项目\n");

        return false;
    }
    else
    {
        while (temp->nextProject != NULL)
        {
            printf("所属项目:%s 项目状态:%s 获奖状况:%s\n",
                   temp->projectName,
                   temp->projectStatus == 0 ? "未开始" : temp->projectStatus == 1 ? "进行中" : "已完成",
                   temp->projectAwards == 0 ? "未获奖" : temp->projectAwards == 1 ? "一等奖" : temp->projectAwards == 2 ? "二等奖" : temp->projectAwards == 3 ? "三等奖" : "四等奖");
            temp = temp->nextProject;
        }
        printf("所属项目:%s 项目状态:%s 获奖状况:%s\n",
               temp->projectName,
               temp->projectStatus == 0 ? "未开始" : temp->projectStatus == 1 ? "进行中" : "已完成",
               temp->projectAwards == 0 ? "未获奖" : temp->projectAwards == 1 ? "一等奖" : temp->projectAwards == 2 ? "二等奖" : temp->projectAwards == 3 ? "三等奖" : "四等奖");
    }

    return true;
}
bool ShowAllThesis(UserList user)
{
    ThesisList temp = (ThesisList)malloc(sizeof(ThesisList));
    temp = user->nextThesis;
    if (temp == NULL)
    {
        //printf("该人员没有论文\n");

        return false;
    }
    else
    {

        while (temp->nextThesis != NULL)
        {
            printf("论文名称:%s 论文ID:%ld 论文状态:%s 获奖情况:%s 论文类型:%s \n",
                   temp->thesisName,
                   temp->thesisId,
                   temp->thesisStatus == 0 ? "未开始" : temp->thesisStatus == 1 ? "进行中" : "已完成",
                   temp->thesisAwards == 0 ? "未获奖" : temp->thesisAwards == 1 ? "国家级" : temp->thesisAwards ? "省部级" : temp->thesisAwards == 2 ? "市厅级" : "校级",
                   temp->thesisType == 0 ? "SCI" : temp->thesisType == 1 ? "EI" : temp->thesisType == 2 ? "核心" : "一般");
            temp = temp->nextThesis;
        }
        printf("论文名称:%s 论文ID:%ld 论文状态:%s 获奖情况:%s 论文类型:%s \n",
               temp->thesisName,
               temp->thesisId,
               temp->thesisStatus == 0 ? "未开始" : temp->thesisStatus == 1 ? "进行中" : "已完成",
               temp->thesisAwards == 0 ? "未获奖" : temp->thesisAwards == 1 ? "国家级" : temp->thesisAwards ? "省部级" : temp->thesisAwards == 2 ? "市厅级" : "校级",
               temp->thesisType == 0 ? "SCI" : temp->thesisType == 1 ? "EI" : temp->thesisType == 2 ? "核心" : "一般");
        return true;
    }
}
bool ShowAllEssay(UserList user)
{
    EssayList temp = (EssayList)malloc(sizeof(EssayList));
    temp = user->nextEssay;
    if (user->nextEssay == NULL)
    {
        //printf("该人员没有引用的著作\n");

        return false;
    }
    else
    {
        while (temp->nextEssay != NULL)
        {
            printf("著作名称:%s 著作ID:ld% 著作类型%s\n",
                   temp->essayName,
                   temp->essayId,
                   temp->essayType == 0 ? "无" : temp->essayType == 1 ? "国家标准" : temp->essayType == 2 ? "行业标准" : temp->essayType == 3 ? "专辑" : temp->essayType == 4 ? "学术专著" : "其他(含译著)");
        }
        printf("著作名称:%s 著作ID:ld% \n",
               temp->essayName,
               temp->essayId,
               temp->essayType == 0 ? "无" : temp->essayType == 1 ? "国家标准" : temp->essayType == 2 ? "行业标准" : temp->essayType == 3 ? "专辑" : temp->essayType == 4 ? "学术专著" : "其他(含译著)");
    }

    return (true);
}

bool ShowUserAll(UserList user)
{
    if (user == NULL)
    {
        return false;
    }
    UserList temp = (UserList)malloc(sizeof(User));
    temp = user;
    printf("ID:%ld 名字:%s \n", temp->id, temp->name);
    ShowAllProject(temp);
    ShowAllThesis(temp);
    ShowAllEssay(temp);
    return true;
}

bool ShowAllUserProject(UserList head)
{
    UserList temp = (UserList)malloc(sizeof(User));
    temp = head;
    if (head->nextUser == NULL)
    {
        printf("表不存在，查询失败\n");

        return false;
    }
    else
    {
        while (temp->nextUser != NULL)
        {
            temp = temp->nextUser;
            ShowAllProject(temp);
        }
        return true;
    }
}

bool ShowAllUserThesis(UserList head)
{
    UserList temp = (UserList)malloc(sizeof(User));
    temp = head;
    if (head->nextUser == NULL)
    {
        printf("表不存在，查询失败\n");

        return false;
    }
    else
    {
        while (temp->nextUser != NULL)
        {

            temp = temp->nextUser;
            ShowAllThesis(temp);
        }
        return true;
    }
}

void ShowRank(UserList head, RankList rankHead)
{
    UserList temp = (UserList)malloc(sizeof(User));
    RankList rank = (RankList)malloc(sizeof(Rank));
    RankList showRank = (RankList)malloc(sizeof(Rank));
    temp = head;
    int i = 0;
    if (head->nextUser == NULL)
    {
        printf("表不存在，查询失败\n");
    }
    else
    {
        while (temp->nextUser != NULL)
        {
            temp = temp->nextUser;
            ProjectList project = (ProjectList)malloc(sizeof(Project));
            ThesisList thesis = (ThesisList)malloc(sizeof(Thesis));
            EssayList essay = (EssayList)malloc(sizeof(Essay));
            int score = 0;
            if (temp->nextProject != NULL)
            {
                project = temp->nextProject;
                score += project->projectAwards == 1 ? 500 : project->projectAwards == 2 ? 300 : project->projectAwards == 3 ? 100 : 0;
                while (project->nextProject != NULL)
                {
                    project = project->nextProject;
                    score += project->projectAwards == 1 ? 500 : project->projectAwards == 2 ? 300 : project->projectAwards == 3 ? 100 : 0;
                }
            }
            if (temp->nextThesis != NULL)
            {
                thesis = temp->nextThesis;
                score += thesis->thesisType == 1 ? 500 : thesis->thesisType == 2 ? 300 : thesis->thesisType == 3 ? 100 : thesis->thesisType == 4 ? 50 : 0;
                while (thesis->nextThesis != NULL)
                {
                    thesis = thesis->nextThesis;
                    score += thesis->thesisType == 1 ? 500 : thesis->thesisType == 2 ? 300 : thesis->thesisType == 3 ? 100 : thesis->thesisType == 4 ? 50 : 0;
                }
            }
            if (temp->nextEssay != NULL)
            {
                essay = temp->nextEssay;
                score += essay->essayType == 1 ? 500 : essay->essayType == 2 ? 300 : essay->essayType == 3 ? 200 : essay->essayType == 4 ? 100 : essay->essayType == 5 ? 50 : 0;
                while (essay->nextEssay != NULL)
                {
                    essay = temp->nextEssay;
                    score += essay->essayType == 1 ? 500 : essay->essayType == 2 ? 300 : essay->essayType == 3 ? 200 : essay->essayType == 4 ? 100 : essay->essayType == 5 ? 50 : 0;
                }
            }
            rank->score = score;
            strcpy(rank->name, temp->name);
            if (AddRank(rankHead, *rank))
            {
                i++;
                continue;
            }
        }
        // BubbleSort(rankHead);
        showRank = rankHead;
        int i = 0;
        while (showRank->nextRank != NULL)
        {
            i++;
            showRank = showRank->nextRank;
            printf("排名:%d  姓名:%s  得分:%d\n", i, showRank->name, showRank->score);
        }
    }
}

bool DeleteUser(UserList head, long id)
{
    UserList lastTemp = (UserList)malloc(sizeof(User));
    UserList temp = (UserList)malloc(sizeof(User));
    if (head->nextUser == NULL || head == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = head->nextUser;
        if (temp->id == id)
        {
            head->nextUser = temp->nextUser;
            free(temp);
            return true;
        }
        lastTemp = temp;
        while (temp->nextUser != NULL)
        {
            temp = temp->nextUser;
            if (temp->id == id)
            {
                lastTemp->nextUser = temp->nextUser;
                free(temp);
                return true;
            }
            lastTemp = temp;
        }
    }
    return false;
}

bool DeleteProject(UserList user, long projectId)
{
    ProjectList lastTemp = (ProjectList)malloc(sizeof(Project));
    ProjectList temp = (ProjectList)malloc(sizeof(Project));
    if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = user->nextProject;
        if (temp->projectId == projectId)
        {
            user->nextProject = temp->nextProject;
            free(temp);
            // head->length--;
            return true;
        }
        lastTemp = temp;
        while (temp->nextProject != NULL)
        {
            temp = temp->nextProject;
            if (temp->projectId == projectId)
            {
                lastTemp->nextProject = temp->nextProject;
                free(temp);
                // head->length--;
                return true;
            }
            lastTemp = temp;
        }
    }
    return false;
}

bool DeleteThesis(UserList user, long thesisId)
{
    ThesisList lastTemp = (ThesisList)malloc(sizeof(Thesis));
    ThesisList temp = (ThesisList)malloc(sizeof(Thesis));
    if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = user->nextThesis;
        if (temp->thesisId == thesisId)
        {
            user->nextThesis = temp->nextThesis;
            free(temp);
            // head->length--;
            return true;
        }
        lastTemp = temp;
        while (temp->nextThesis != NULL)
        {
            temp = temp->nextThesis;
            if (temp->thesisId == thesisId)
            {
                lastTemp->nextThesis = temp->nextThesis;
                free(temp);
                // head->length--;
                return true;
            }
            lastTemp = temp;
        }
    }
    return false;
}

bool DeleteEssay(UserList user, long essayId)
{
    EssayList lastTemp = (EssayList)malloc(sizeof(Essay));
    EssayList temp = (EssayList)malloc(sizeof(Essay));
    if (user->nextUser == NULL || user == NULL)
    {
        status = 0;
        exit(-1);
    }
    else
    {
        temp = user->nextEssay;
        if (temp->essayId == essayId)
        {
            user->nextEssay = temp->nextEssay;
            free(temp);
            return true;
        }
        lastTemp = temp;
        while (temp->nextEssay != NULL)
        {
            temp = temp->nextEssay;
            if (temp->essayId == essayId)
            {
                lastTemp->nextEssay = temp->nextEssay;
                free(temp);
                return true;
            }
            lastTemp = temp;
        }
    }
    return false;
}

void AddUserApp(UserList head)
{
    char name[256];
    long id;
    printf("请输入添加人员id:");
    while (!scanf("%ld", &id))
    {
        printf("你输入的不是数字，请重新输入:\n");
        fflush(stdin);
    }
    printf("请输入人员姓名:");
    scanf("%s", name);

    AddUser(head, id, name);

    printf("是否继续添加项目信息\ny 是 其他键 否\n");
    fflush(stdin);
    char c = _getch();
    if (c == 'y')
    {
        AddProjectApp(head, id);
    }
    printf("是否继续添加论文信息\n y 是 其他按键 否\n");
    fflush(stdin);
    c = _getch();
    if (c == 'y')
    {
        AddThesisApp(head, id);
    }
    printf("是否继续添加著作信息\n y 是 其他按键 否");
    fflush(stdin);
    c = _getch();
    if (c == 'y')
    {
        AddEssayApp(head, id);
    }
    return;
}

//以下所有的应用输入都要传入两个参数，如果是直接调用需要输入用户ID
//就要往第二个参数传入数字0
void AddProjectApp(UserList head, long userId)
{

    long projectId;
    char projectName[256];
    short projectStatus;
    short ProjectAwards;

    //userID为0时需要用户自行输入用户ID
    if (userId == 0)
    {
        printf("请输入要添加的项目的管理人员ID:");
        while (!scanf("%ld", &userId))
        {
            printf("请输入正确的ID信息!\n");
            fflush(stdin);
        }
    }
    //fflush(stdin);
    printf("请输入要添加的项目的ID:");
    while (!scanf("%ld", &projectId))
    {
        printf("请输入正确的ID信息!\n");
        fflush(stdin);
    }
    printf("请输入要添加的项目的名称:");
    fflush(stdin);
    scanf("%s", projectName);
    printf("请输入项目的状态:\n1:未开始 2:进行中 3:已完成\n");
    fflush(stdin);
    while (true)
    {
        if (scanf("%hd", &projectStatus))
        {
            if (projectStatus <= 3 && projectStatus >= 1)
            {
                fflush(stdin);
                break;
            }
        }
        fflush(stdin);
        printf("请输入正确的数据类型\n");
    }
    printf("请输入项目获奖情况\n0为未获奖 1为一等奖 2为二等奖 3为三等奖\n");
    while (true)
    {
        if (scanf("%hd", &ProjectAwards))
        {
            if (projectStatus <= 3 && ProjectAwards >= 0)
            {
                fflush(stdin);
                break;
            }
        }
        fflush(stdin);
        printf("请输入正确的数据类型\n");
    }

    if (AddProject(SearchUser(head, userId), projectId, projectName, projectStatus, ProjectAwards))
    {
        printf("添加成功\n");
        return;
    }
    else
    {
        printf("失败\n");
    }
}

void AddThesisApp(UserList head, long userId)
{
    long thesisId;
    char thesisName[256];
    short thesisStatus;
    short thesisAwards;
    short thesisType;

    if (userId == 0)
    {
        printf("请输入要添加的论文的撰写人员ID:");
        while (!scanf("%ld", &userId))
        {
            printf("请输入正确的ID信息!\n");
            fflush(stdin);
        }
    }

    fflush(stdin);
    printf("请输入要添加的论文的ID:");
    while (!scanf("%ld", &thesisId))
    {
        printf("请输入正确的ID信息!\n");
        fflush(stdin);
    }

    printf("请输入要添加的论文的名称:");
    fflush(stdin);
    while (!scanf("%s", thesisName))
    {
        printf("请输入正确的ID信息!\n");
        fflush(stdin);
    }

    fflush(stdin);
    printf("请输入论文的状态:\n1:未开始 2:进行中 3:已完成\n");
    while (true)
    {
        if (scanf("%hd", &thesisStatus))
        {
            if (thesisStatus <= 3 && thesisStatus >= 0)
            {
                fflush(stdin);
                break;
            }
        }
        fflush(stdin);
        printf("请输入正确的数据类型\n");
    }

    fflush(stdin);
    printf("请输入论文获奖情况\n0为未获奖，1国家级，2为省部级，3为市厅级,4为校级\n");
    while (true)
    {
        if (scanf("%hd", &thesisAwards))
        {
            if (thesisAwards <= 4 && thesisAwards >= 0)
            {
                fflush(stdin);
                break;
            }
        }
        fflush(stdin);
        printf("请输入正确的数据类型\n");
    }

    fflush(stdin);
    printf("请输入论文类型\n0为无，1为SCI(500)，2为EI(300)，3为核心(100)，4为一般(50)\n");
    while (true)
    {
        if (scanf("%hd", &thesisType))
        {
            if (thesisType <= 4 && thesisType >= 0)
            {
                fflush(stdin);
                break;
            }
        }
        fflush(stdin);
        printf("请输入正确的数据类型\n");
    }

    if (AddThesis(SearchUser(head, userId), thesisId, thesisName, thesisStatus, thesisAwards, thesisType))
    {
        printf("添加成功\n");
        return;
    }
    else
    {
        printf("失败\n");
    }
}

void AddEssayApp(UserList head, long userId)
{
    long essayId;
    char essayName[256];
    short essayType;

    if (userId == 0)
    {
        printf("请输入要添加的论文的撰写人员ID:");
        while (!scanf("%ld", &userId))
        {
            printf("请输入正确的ID信息!\n");
            fflush(stdin);
        }
    }

    fflush(stdin);
    printf("请输入要添加的著作的ID:");
    while (!scanf("%ld", &essayId))
    {
        printf("请输入正确的ID信息!\n");
        fflush(stdin);
    }

    printf("请输入要添加的著作的名称:");
    fflush(stdin);
    scanf("%s", essayName);
    printf("请输入论文的状态:\n1:未开始 2:进行中 3:已完成\n");

    fflush(stdin);
    printf("请输入著作类型\n0为无，1为国家标准(500)，2为行业标准(300)，3为专辑(200)，4为学术专著(100)，5为其他（含译著）(50)\n");
    while (true)
    {
        if (scanf("%hd", &essayType))
        {
            if (essayType <= 5 && essayType >= 0)
            {
                fflush(stdin);
                break;
            }
        }
        fflush(stdin);
        printf("请输入正确的数据类型\n");
    }

    if (AddEssay(SearchUser(head, userId), essayId, essayName, essayType))
    {
        printf("添加成功\n");
        return;
    }
    else
    {
        printf("失败\n");
    }
}

void ShowUserAllApp(UserList head)
{
    long userId;
    printf("请输入要删除的用户Id:");
    while (!scanf("%ld", &userId))
    {
        printf("请输入正确的数据类型");
        fflush(stdin);
    }
    if (SearchUser(head, userId) == NULL)
    {
        printf("未找到此用户!\n");
        return;
    }
    ShowUserAll(SearchUser(head, userId));
    return;
}

void DeleteUserApp(UserList head)
{
    long userId;
    printf("请输入要删除的用户Id:");
    while (!scanf("%ld", &userId))
    {
        printf("请输入正确的数据类型\n");
        fflush(stdin);
    }
    if (SearchUser(head, userId) == NULL)
    {
        printf("未找到此用户!\n");
        return;
    }
    ShowUserAll(SearchUser(head, userId));
    printf("确定要删除此人员吗?\ny 是 其他按键 否\n");

    fflush(stdin);
    char c = _getch();
    if (c == 'y')
    {
        if (DeleteUser(head, userId))
        {
            printf("删除成功\n");
            return;
        }
    }
    printf("取消删除\n");
    return;
}

void DeleteProjectApp(UserList head)
{
    long userId;
    long projectId;
    printf("请输入要删除项目的用户Id:");
    while (!scanf("%ld", &userId))
    {
        printf("请输入正确的数据类型\n");
        fflush(stdin);
    }
    if (SearchUser(head, userId) == NULL)
    {
        printf("未找到此用户!\n");
        return;
    }
    ShowAllProject(SearchUser(head, userId));
    printf("请输入要删除项目的项目Id:");
    while (!scanf("%ld", &projectId))
    {
        printf("请输入正确的数据类型");
        fflush(stdin);
    }
    if (SearchProject(SearchUser(head, userId), projectId) == NULL)
    {
        printf("未找到此项目!\n");
        return;
    }

    printf("确定要删除此项目吗?\ny 是 其他按键 否\n");
    fflush(stdin);
    char c = _getch();
    if (c == 'y')
    {
        if (DeleteProject(SearchUser(head, userId), projectId))
        {
            printf("删除成功\n");
            return;
        }
    }
    printf("取消删除\n");
    return;
}

void DeleteThesisApp(UserList head)
{
    long userId;
    long thesesId;
    printf("请输入要删除论文的用户Id:");
    while (!scanf("%ld", &userId))
    {
        printf("请输入正确的数据类型");
        fflush(stdin);
    }
    if (SearchUser(head, userId) == NULL)
    {
        printf("未找到此用户!\n");
        return;
    }
    ShowAllProject(SearchUser(head, userId));
    printf("请输入要删除项目的论文Id:");
    while (!scanf("%ld", &thesesId))
    {
        printf("请输入正确的数据类型");
        fflush(stdin);
    }
    if (SearchThesis(SearchUser(head, userId), thesesId) == NULL)
    {
        printf("未找到此论文!\n");
        return;
    }

    printf("确定要删除此论文吗?\ny 是 其他按键 否");
    fflush(stdin);
    char c = _getch();
    if (c == 'y')
    {
        if (DeleteThesis(SearchUser(head, userId), thesesId))
        {
            printf("删除成功\n");
            return;
        }
    }
    printf("取消删除\n");
    return;
}

void ExitProject()
{
    printf("确定要退出程序吗？\n y 确定 其他键 取消");
    char c = _getch();
    if (c == 'y')
    {
        printf("\n即将退出程序\n");
        system("pause");
        exit(-1);
    }
    printf("\n取消退出程序\n");
    system("pause");
}

void Menu(UserList head) //主界面
{
    system("cls");
    printf("欢迎使用德州学院科研信息管理系统！\n");
    printf("\t\t\t\t================================================\n");
    printf("\t\t\t\t| 1:查询信息             |                     |\n");
    printf("\t\t\t\t| 2:人员操作面板         |                     |\n");
    printf("\t\t\t\t| 3:项目操作面板         |                     |\n");
    printf("\t\t\t\t| 4:论文管理面板         |                     |\n");
    printf("\t\t\t\t| 5:退出系统             |                     |\n");
    printf("\t\t\t\t================================================\n");
    printf("请选择:");
    Set(head); //调用功能选择函数
}

void Set(UserList head)
{
    fflush(stdin); //清除缓冲区，防止读入回车符
    char c = _getch();
    switch (c)
    {
    case '1':
        InformationPanel(head);
    case '2':
        UserPanel(head);
    case '3':
        ProjectPanel(head);
        break;
    case '4':
        ThesisPanel(head);
    case '5':
        ExitProject();
        BackMenu(head);
    default:
        printf("请重新输入有效序号:\n");
        Set(head); //重新加载主菜单
    }
}

//查询信息面板
void InformationPanel(UserList head)
{
    system("cls");
    printf("欢迎使用德州学院科研信息管理系统！\n");
    printf("\t\t\t\t==================================================\n");
    printf("\t\t\t\t| >>>>  1:查询信息       |  6:显示所有人员       |\n");
    printf("\t\t\t\t| 2:人员操作面板         |  7:查询人员详细信息   |\n");
    printf("\t\t\t\t| 3:项目操作面板         |  8:显示积分排名       |\n");
    printf("\t\t\t\t| 4:论文管理面板         |  9:显示所有项目       |\n");
    printf("\t\t\t\t| 5:退出系统             |  0:显示所有论文       |\n");
    printf("\t\t\t\t==================================================\n");
    printf("请选择:");
    SetInformation(head);
}

//查询信息
void SetInformation(UserList head)
{
    fflush(stdin); //清除缓冲区，防止读入回车符
    char a = _getch();
    switch (a)
    {
    case '1':
        InformationPanel(head);
    case '2':
        UserPanel(head);
    case '3':
        ProjectPanel(head);
        break;
    case '4':
        ThesisPanel(head);
        break;
    case '5':
        ExitProject();
        BackMenu(head);
    case '6':
        printf("\n");
        fflush(stdin);
        ShowAllUser(head);
        BackMenu(head);
    case '7':
        fflush(stdin);
        ShowUserAllApp(head);
        BackMenu(head);
    case '8':
        printf("\n");
        fflush(stdin);
        ShowRank(head, InitRank());
        BackMenu(head);
    case '9':
        fflush(stdin);
        ShowAllUserProject(head);
        BackMenu(head);
    case '0':
        fflush(stdin);
        ShowAllUserThesis(head);
        BackMenu(head);
    default:
        printf("请重新输入有效序号:\n");
        Set(head); //重新加载主菜单
    }
}

//操作用户面板
void UserPanel(UserList head)
{
    system("cls");
    printf("欢迎使用德州学院科研信息管理系统！\n");
    printf("\t\t\t\t==================================================\n");
    printf("\t\t\t\t| 1:查询信息             | 6:增加人员信息        |\n");
    printf("\t\t\t\t| >>>>  2:人员操作面板   | 7:修改人员信息        |\n");
    printf("\t\t\t\t| 3:项目操作面板         | 8:删除人员信息        |\n");
    printf("\t\t\t\t| 4:论文管理面板         |                       |\n");
    printf("\t\t\t\t| 5:退出系统             |                       |\n");
    printf("\t\t\t\t==================================================\n");
    printf("请选择:");
    SetUser(head);
}

//人员操作
void SetUser(UserList head)
{
    fflush(stdin); //清除缓冲区，防止读入回车符
    char a = _getch();
    switch (a)
    {
    case '1':
        InformationPanel(head);
    case '2':
        UserPanel(head);
    case '3':
        ProjectPanel(head);
    case '4':
        ThesisPanel(head);
    case '5':
        ExitProject();
        BackMenu(head);
    case '6':
        AddUserApp(head);
        BackMenu(head);
    case '7':
        ModifyUserApp(head);
        BackMenu(head);
    case '8':
        DeleteUserApp(head);
        BackMenu(head);
    default:
        printf("请重新输入有效序号:\n");
        Set(head); //重新加载主菜单
    }
}

void ProjectPanel(UserList head)
{
    system("cls");
    printf("欢迎使用德州学院科研信息管理系统！\n");
    printf("\t\t\t\t==================================================\n");
    printf("\t\t\t\t| 1:查询信息             | 6:显示所有项目        |\n");
    printf("\t\t\t\t| 2:人员操作面板         | 7:增加项目信息        |\n");
    printf("\t\t\t\t| >>>>  3:项目操作面板   | 8:修改项目信息        |\n");
    printf("\t\t\t\t| 4:论文管理面板         | 9:删除项目信息        |\n");
    printf("\t\t\t\t| 5:退出系统             |                       |\n");
    printf("\t\t\t\t==================================================\n");
    printf("请选择:");
    SetProjuct(head);
}

//项目面板
void SetProjuct(UserList head)
{
    fflush(stdin); //清除缓冲区，防止读入回车符
    char a = _getch();
    switch (a)
    {
    case '1':
        InformationPanel(head);
    case '2':
        UserPanel(head);
    case '3':
        ProjectPanel(head);
    case '4':
        ThesisPanel(head);
    case '5':
        ExitProject();
        BackMenu(head);
    case '6':
        printf("\n");
        fflush(stdin);
        ShowAllUserProject(head);
        BackMenu(head);
    case '7':
        fflush(stdin);
        AddThesisApp(head, 0);
    case '8':
        fflush(stdin);
        ModifyProjectApp(head, 0);
        BackMenu(head);
    case '9':
        fflush(stdin);
        DeleteProjectApp(head);
        BackMenu(head);
    default:
        printf("请重新输入有效序号:\n");
        Set(head); //重新加载主菜单
    }
}

void ThesisPanel(UserList head)
{
    system("cls");
    printf("欢迎使用德州学院科研信息管理系统！\n");
    printf("\t\t\t\t==================================================\n");
    printf("\t\t\t\t| 1:查询信息             | 6:显示所有论文        |\n");
    printf("\t\t\t\t| 2:人员操作面板         | 7:增加论文信息        |\n");
    printf("\t\t\t\t| 3:项目操作面板         | 8:修改论文信息        |\n");
    printf("\t\t\t\t| >>>>  4:论文管理面板   | 9:删除论文信息        |\n");
    printf("\t\t\t\t| 5:退出系统             |                       |\n");
    printf("\t\t\t\t==================================================\n");
    printf("请选择:");
    SetThesis(head);
}

//论文选择
void SetThesis(UserList head)
{
    fflush(stdin); //清除缓冲区，防止读入回车符
    char a = _getch();
    switch (a)
    {
    case '1':
        InformationPanel(head);
    case '2':
        UserPanel(head);
    case '3':
        ProjectPanel(head);
    case '4':
        ThesisPanel(head);
    case '5':
        ExitProject();
        BackMenu(head);
    case '6':
        printf("\n");
        fflush(stdin);
        ShowAllUserThesis(head);
        BackMenu(head);
    case '7':
        fflush(stdin);
        AddThesisApp(head, 0);
        BackMenu(head);
    case '8':
        fflush(stdin);
        ModifyThesisApp(head, 0);
        BackMenu(head);
    case '9':
        fflush(stdin);
        DeleteThesisApp(head);
    default:
        printf("请重新输入有效序号:\n");
        Set(head); //重新加载主菜单
    }
}

void BackMenu(UserList head)
{
    printf("操作完成，即将返回主菜单\n");
    system("pause");
    Menu(head);
}
void InitInformation(UserList head)
{
    char *firstName = {"张李王孙曹张李王孙曹"};
    char *lastName = {"秀娟英华慧伟刚勇毅俊"};
    char *projectFirst = {"写抄搬运打学吃听唱说"};
    char *projectLast = {"作书砖煤字车饭书歌话"};
    char *thesisFirst = {"关于"};
    char *thesisLast = {"的研究"};
    char name[10];
    char projectName[10];
    int no = 0;
    for (int i = 0; i < 20; i = i + 2)
    {
        char thesisName[500] = {""};
        no++;
        name[0] = firstName[i];
        name[1] = firstName[i + 1];
        name[2] = lastName[i];
        name[3] = lastName[i + 1];
        name[4] = '\0';
        projectName[0] = projectFirst[i];
        projectName[1] = projectFirst[i + 1];
        projectName[2] = projectLast[i];
        projectName[3] = projectLast[i + 1];
        projectName[4] = '\0';
        strcat(thesisName, thesisFirst);
        strcat(thesisName, projectName);
        strcat(thesisName, thesisLast);
        AddUser(head, no, name);
        AddProject(SearchUser(head, no), 1, projectName, 2, 3 - i % 3);
        AddThesis(SearchUser(head, no), 1, thesisName, 2, i % 3, 4 - i % 5);
    }
}
int main(int argc, char const *argv[])
{
    UserList head;
    head = InitUser();
    printf("\n");
    InitInformation(head);
    Login(head);
    return 0;
}